CC=g++
CXXFLAGS=-c -Wall -g
LDFLAGS=-lopencv_core -lopencv_highgui -lopencv_imgproc -lpthread
SERVER_OBJECTS = polygon.o colors.o server.o mainloop.o vision.o
CHECKER_OBJECTS = polygon.o colors.o vision.o checker.o
SERVER=2489_vserver

all: $(SERVER) checker client

$(SERVER): $(SERVER_OBJECTS)
	$(CC) $(LDFLAGS) $(SERVER_OBJECTS) -o $(SERVER)

checker: $(CHECKER_OBJECTS)
	$(CC) $(LDFLAGS) $(CHECKER_OBJECTS) -o checker

client: client.o
	$(CC) $(LDFLAGS) client.o -o client

$(SERVER_OBJECTS):colors.h server.h polygon.h
$(CHECKER_OBJECTS):colors.h server.h polygon.h

clean:
	-rm *.o $(SERVER) checker client

install:
	systemctl stop 2489_vserver
	install $(SERVER) /usr/bin
	install 2489_vserver.service /lib/systemd/system
	systemctl --system daemon-reload
	systemctl start 2489_vserver
